hartid: .int
.global hartid

.global _start
.extern sys_stackEnd
.section .text
_start:
/* Get the hartid in S-mode */
    la t0, hartid                
    mv t1, a0                         
    sw t1, (t0)
    la sp, sys_stackEnd
    # init the fs in mstatus/sstatus to enable f/d instructions
    li t0, 0x2000
#if defined(OS_ARCH_SMODE)
    csrrs zero, sstatus, t0   
#else
    csrrs zero, mstatus, t0
#endif
    call main
_spin:
    wfi 
    j _spin
